package main

import (
	"fmt"
)

type account struct{
	accountNum string 
	pwd string 
	balance float64 
}

func (a *account)Deposite(money float64,pwd string){

	if pwd !=a.pwd{
		fmt.Println("密码不对")
	}
	if money<=0{
		fmt.Println("金额不对")
	}
	a.balance+=money 
	fmt.Println("存款成功")
}

func (a*account)Withdraw(money float64,pwd string){
	if pwd !=a.pwd{
		fmt.Println("密码不对")
	}
	if money<=0 || money>a.balance{
		fmt.Println("金额不对")
	}
	a.balance-=money 
	fmt.Println("取款成功")
}
func (a*account)Query(pwd string){

	if pwd!=a.pwd{
		fmt.Println("密码不对")
	}

	fmt.Printf("你的账号为：%v,余额为:%v\n",a.accountNum,a.balance)
}
func main(){

	accountx:=&account{
		accountNum:"gs111",
		pwd:"111",
		balance:100.22,
	}

	accountx.Deposite(12.22,"111")
	accountx.Query("111")

	accountx.Withdraw(20.22,"111")
	accountx.Query("111")

}